﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Landscape.Business.Common
{
    public class LandscapeException : Exception
    {
        private bool _logToDataBase;
        private bool _hideFullException = false; //This will throw friendly message provided
        private Dictionary<string, object> _clientObjects;
        private string _frendlyMessage = string.Empty;

        public LandscapeException()
        {

        }
        
        public LandscapeException(string pMsg)
        {
            this._frendlyMessage = pMsg;            
        }

        /// <summary>
        /// Adds a client object to the exception collection
        /// </summary>
        /// <param name="pName">Name of the object. This is to identify the object.</param>
        /// <param name="pObject">Intended object to send</param>
        public void AddToClientObject(string pName, object pObject)
        {
            this._clientObjects.Add(pName, pObject);
        }

        public override string Message
        {
            get
            {
                return this._frendlyMessage;
                //if (!_hideFullException)
                //{
                //    return base.Message;
                //}
                //else
                //{
                //    return this._frendlyMessage;
                //}
            }
        }

        public Dictionary<string, object> ClientObjects
        {
            get
            {
                return this._clientObjects;
            }
        }
    }
}
